package com.xz.knowledgeDuplication.pattern.visitor;

import java.util.ArrayList;
import java.util.List;


/**
 * 家(结构对象角色)
 *
 * @author 召
 * @date 2022-03-30 21:42:10
 */
public class Home {

    List<Animal> animalList = new ArrayList<Animal>();

    public void action(Person person) {
        for (Animal animal : animalList) {
            animal.accept(person);
        }
    }

    public void add(Animal animal) {
        animalList.add(animal);
    }
}
